let sum1 = 0.0;
let sum2 = 0.0;
// let tempT = $this.formModel.input_1690251140109_ru3E3
//备用金取值
let formData = new FormData();
let tempWhere = [//条件：《备用金归还》查询《备用金》数据
    {
        "key": $this.$util.uuid(), "str": "systemSelect_1690250265538_jQLI9_ID", //【备用金-申请人】
        "condition": "eq", //查询条件
        "t_value": $this.formModel.systemSelect_1710212012021_80J9n_ID, //【备用金归还-归还人】
        "whId": "bb30dd2425a8ff791858402e98516706", //备用金 后端api接口
        "type": "head"
    }, {
        "key": $this.$util.uuid(), "str": "deleted",
        "condition": "eq", //查询条件
        "t_value": 0,
        "whId": "bb30dd2425a8ff791858402e98516706", //备用金 后端api接口
        "type": "head"
    }]
formData.append("where", JSON.stringify(tempWhere));
formData.append("authority", "false");
// 根据表单应用标识 bb30dd2425a8ff791858402e98516706 需要哪个表单数据，就写哪个表单id
$this.$http.post('/wind/tableByWhId/bb30dd2425a8ff791858402e98516706', formData).then(res => {
    if (res.data.code === 280) {
        let data = res.data.list;
        //备用金【备用金】 -> 备用金归还【备用金】
        if (data.length > 0) {
            //获取王所有申请的备用金
            for (let i = 0; i < data.length; i++) {
                // 备用金归还【备用金】 += 备用金【备用金】
                $this.formModel.money_1690251140109_LodPl += data[i].money_1690250396534_T3xcc
            }
        }
        let temp = $this.formModel.money_1690251140109_LodPl;
        // let resultT = ;
        //备用金归还【归还金额】历史
        let formData1 = new FormData();
        let tempWhere1 = [//条件：《备用金归还》查询《备用金》数据
            {
                "key": $this.$util.uuid(), "str": "systemSelect_1690251140109_eeAOZ_ID", //【备用金归还-申请人】
                "condition": "eq", //查询条件
                "t_value": $this.formModel.systemSelect_1710212012021_80J9n_ID, //【备用金归还-归还人】- 当前页面参数
                "whId": "f2244ee020a43e5ee8b9fd894149a75f", //备用金 后端api接口
                "type": "head"
            }, {
                "key": $this.$util.uuid(), "str": "deleted", //【备用金归还-申请人】
                "condition": "eq", //查询条件
                "t_value": 0, //【备用金归还-报销人】
                "whId": "f2244ee020a43e5ee8b9fd894149a75f", //备用金 后端api接口
                "type": "head"
            }
        ]
        formData1.append("where", JSON.stringify(tempWhere1));
        formData1.append("authority", "false");
        $this.$http.post('/wind/tableByWhId/f2244ee020a43e5ee8b9fd894149a75f', formData1).then(res => {
            if (res.data.code === 280) {
                let data = res.data.list;
                if (data.length > 0) {
                    for (let i = 0; i < data.length; i++) {
                        if (data[i].money_1690251154579_FbiL2 !== null && data[i].money_1690251154579_FbiL2 !== undefined) {
                            //备用金归还【备用金剩余金额】 = 备用金归还【备用金】 - 备用金归还【归还金额】历史
                            sum1 += data[i].money_1690251154579_FbiL2;
                        }
                    }
                }
            } else {
                $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
            }
        }).catch(e => {
            $this.$message.error(e.message);
        });


        //项目报销【冲抵备用金】历史
        let formData2 = new FormData();
        let tempWhere2 = [//条件：《备用金归还》查询《项目报销》数据
            {
                "key": $this.$util.uuid(), "str": "systemSelect_1690254260762_EfPrp_ID", //【项目报销-报销人】
                "condition": "eq", //查询条件
                "t_value": $this.formModel.systemSelect_1710212012021_80J9n_ID,  //【备用金归还-归还人】
                "whId": "f35850d94690082362eeaef123a42b75", //项目报销 后端api接口
                "type": "head"
            }, {
                "key": $this.$util.uuid(), "str": "deleted",
                "condition": "eq", //查询条件
                "t_value": 0,
                "whId": "f35850d94690082362eeaef123a42b75", //备用金 后端api接口
                "type": "head"
            }]
        formData2.append("where", JSON.stringify(tempWhere2));
        formData2.append("authority", "false");
        // 根据表单应用标识
        $this.$http.post('/wind/tableByWhId/f35850d94690082362eeaef123a42b75', formData2).then(res => {
            if (res.data.code === 280) {
                let data = res.data.list;
                if (data.length > 0) {
                    for (let i = 0; i < data.length; i++) {
                        if(data[i].money_1690254237127_oOtXW !== null && data[i].money_1690254237127_oOtXW !== undefined) {
                            // 备用金归还【备用金剩余金额】 =  备用金归还【备用金】 - 项目报销【冲抵备用金】历史
                            sum2 += data[i].money_1690254237127_oOtXW;
                        }
                    }
                    $this.formModel.input_1690251140109_ru3E3 = temp - parseFloat(sum1 + sum2);
                }
            } else {
                $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
            }
        }).catch(e => {
            $this.$message.error(e.message);
        });
    } else {
        $this.$message.error(res.data.msg ? res.data.msg : $this.$t('result.error.common.msg'));
    }
}).catch(e => {
    $this.$message.error(e.message);
});